{{include_file name='public/header' title='登录历史'}}

</head>

<body>

<div id="wrapper">

    <!-- Navigation -->
    {{include_file name='public/nav' sidebar='sidebar'}}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">登录历史</h1>
                <div class="search">
                    <div class="well">
                        <form class="form-inline" action="{{url()}}" method="get">
                            <div class="form-group">
                                <label>昵称/账号</label>
                                <input type="text" name="search[name]" class="form-control" placeholder="支持模糊查询" value="{{$search.name}}">
                            </div>
                            <div class="form-group">
                                <label>登录IP</label>
                                <input type="text" name="search[ip]" class="form-control" placeholder="支持模糊查询" value="{{$search.ip}}">
                            </div>
                            <div class="form-group">
                                <label>登录设备</label>
                                <select class="form-control" name="search[device]">
                                    {{$devices = \app\user::get_device_list('title')}}
                                    <option value="">不限</option>
                                    {{foreach $devices as $k => $device}}
                                    <option value="{{$k}}" {{if $k == $search.device}}selected{{/if}}>{{$device}}</option>
                                    {{/foreach}}
                                </select>
                            </div>
                            <button type="submit" class="btn btn-primary">搜索</button>
                        </form>
                    </div>

                </div>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">

                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>用户昵称</th>
                                    <th>登录账号</th>
                                    <th>登录IP</th>
                                    <th>登录地点</th>
                                    <th>登录时间</th>
                                    <th>登录方式</th>

                                </tr>
                                </thead>
                                <tbody>
                                {{if $historys}}
                                {{foreach $historys as $history}}
                                {{$device  = $history.device}}
                                <tr>
                                    <td >{{$history.user_name}}</td>
                                    <td >{{$history.user_email}}</td>
                                    <td >{{$history.ip}}</td>
                                    <td >{{$history.address}}</td>
                                    <td >{{$history.add_time}}</td>
                                    <td >
                                        {{\app\user::get_device_list('icon', $device)}}
                                    </td>
                                </tr>
                                {{/foreach}}
                                {{/if}}

                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <div class="col-sm-12">
                {{include_file name='public/page'}}

            </div>

            <!-- /.col-lg-6 -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <hr>
    <p class="text-center">{{get_config('copyright')}}</p>
    {{include_file name='public/footer'}}
